-- msg_relic_eggs_bonus
-- Create by cheny3
-- 通知遗迹彩蛋信息

return function(lpc)
    local bonus = lpc.bonus;
    local eggId = lpc.egg_id;

    -- 抛出奖励事件
    EventMgr.fire(event.RELIC_EGG_BONUS, { ["bonus"] = bonus, ["id"] = eggId });

    -- 玩家的彩蛋信息
    local relicEggsInfo = ME.user.dbase:query("relic_eggs_info");

    -- 删除点击次数
    local clickTimes = relicEggsInfo["click_times"] or {};
    clickTimes[eggId] = nil;
    relicEggsInfo["click_times"] = clickTimes;

    -- 删除彩蛋
    local eggList = relicEggsInfo["egg_list"] or {};
    local newList = {};
    for _, id in pairs(eggList) do
        if id ~= eggId then
            table.insert(newList, id);
        end
    end
    relicEggsInfo["egg_list"] = newList;

    -- 增加彩蛋出现次数
    local pickTimes = relicEggsInfo["pick_times"] or {};
    if type(pickTimes[eggId]) == "number" then
        pickTimes[eggId] = pickTimes[eggId] + 1;
    else
        pickTimes[eggId] = 1;
    end
    relicEggsInfo["pick_times"] = pickTimes;

    -- 更新信息
    ME.user.dbase:set("relic_eggs_info", relicEggsInfo);

    -- 删除掉位置信息
    SkyRelicM.deleteRelicPosInfoByType("eggs", eggId);

    -- 抛出刷新事件
    -- EventMgr.fire(event.RELIC_REFRESH_MAP, {});
end
